# encoding: utf-8
# @File  : page_kaihaodian.py
# @Author: wu shaofan
# @Date  :  2024/05/04
# @Desc :
from selenium.webdriver.common.by import By
from PO.base.base import Base


class PageKaihaodian(Base):
    # 用户名
    username = By.CSS_SELECTOR, 'div[class="el-input el-input--prefix"] input[placeholder="账号"]'
    # 密码
    password = By.CSS_SELECTOR, 'div[class="el-input el-input--prefix"] input[placeholder="密码"]'
    # 登录
    login_btn = By.CSS_SELECTOR, 'button[type="button"] span'
    # 商品管理菜单
    goods_manage_menu = By.CSS_SELECTOR, '#app > div > div.main-content > div.main-left > div:nth-child(6) > span'
    # 添加商品按钮
    add_goods_btn = By.CSS_SELECTOR, 'span[class="button-add button-color"]'
    # 输入用户名

    def page_input_username(self, username):
        self.base_input(self.username, username)
        self.base_get_allure_image()

    # 输入密码
    def page_input_password(self, password):
        self.base_input(self.password, password)
        self.base_get_allure_image()

    # 点击登录按钮
    def page_click_login_button(self):
        self.base_click(self.login_btn)
        self.base_get_allure_image()

    # 点击商品管理菜单
    def page_click_goods_manage_menu(self):
        self.base_click(self.goods_manage_menu)
        self.base_get_allure_image()

    # 点击添加商品按钮
    def page_click_add_goods_button(self):
        self.base_click(self.add_goods_btn)
        self.base_get_allure_image()
